import os
from flask import Flask,render_template,flash,redirect,url_for
from unit4.utils.registerForm import RegisterForm,init_csrf


app = Flask(__name__)
app.config['SECRET_KEY'] = os.urandom(32)
# 开始csrf保护
init_csrf(app)
@app.route('/register', methods=['GET', 'POST'])
def register():
    form = RegisterForm()
    if form.validate_on_submit():
        return '注册成功'
    return render_template('register.html', form=form)

if __name__ == '__main__':
    app.run(debug=True,port=5001)